<?php
/**
 * Created by PhpStorm.
 * User: mrren
 * Date: 2019/1/15
 * Time: 1:05 PM
 */

namespace libs\init;

use epii\admin\center\config\LoginPageConfig;
use epii\admin\center\config\Settings;
use epii\admin\center\libs\Tools;
use epii\server\Args;

class LoginPageConfigInit extends LoginPageConfig
{

    public function getConfigs(): array
    {
        $successurl = Args::configVal("login_success_url");
        $config = ["success_url" => $successurl?$successurl:Tools::get_web_root()];
        $allset = Settings::get();
        foreach ($allset as $key => $value) {
            if(stripos($key,"app.login.")===0){
                $config[str_replace("app.login.","",$key)] = $value;
            }
        }
        if(isset($config["bg_imgs"]) && $config["bg_imgs"]){
            $config["bg_imgs"] = explode(",", $config["bg_imgs"]);
        }
//        $config['logo']='https://cyz.oss-cn-north-2.unicloudsrv.com/uploads/202312/88feee39eddb08a1d46e52a1d5a65ba5.png';

        return $config;
    }
}